﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HeroDream
{
    /// <summary>
    /// 战斗任务
    /// 有一定概率受伤，需要养伤，花费时间
    /// </summary>
    class BattleTask:Task
    {

        public BattleTask(int send):base(send)
        {
            Random random = new Random(DateTime.Now.Millisecond + send);
            id = random.Next(1, 100);
            des = $"【战斗任务{id}】——和怪物进行搏杀";
            coin = random.Next(10, 150);
            time = random.Next(1, 5);
            type = TaskType.Battle;
        }

        public override void TaskRun(Hero hero)
        {
            base.TaskRun(hero);
            Random random = new Random(DateTime.Now.Millisecond );
            int rand = random.Next(0, 100);
            if (rand < 20)
            {
                int year = random.Next(1, 5);
                Console.WriteLine($"你在战斗中受伤了，花费{year}年进行了修养");
                hero.age += year;
            }
        }

    }
}
